package main

import (
	"com.go-micro.code/todolist/go-micro-todolist/user/config"
	"com.go-micro.code/todolist/go-micro-todolist/user/core"
	"com.go-micro.code/todolist/go-micro-todolist/user/services"
	"go-micro.dev/v4"
	"log"
)

func main() {
	//1.配置初始化
	err := config.Init()
	if err != nil {
		log.Fatalln(err)
	}
	//2.创建微服务实例 (选择默认mdns注册)
	srv := micro.NewService(
		micro.Name("userService"),
		micro.Address(":8082"),
	)
	//3.结构命令行参数，初始化
	srv.Init()
	//4.服务注册
	err = services.RegisterUserServiceHandler(srv.Server(), &core.UserService{})
	if err != nil {
		log.Fatalln(err)
	}
	err = srv.Run()
	if err != nil {
		log.Fatalln(err)
	}
}
